﻿using System;
using System.Net;
using System.ServiceModel.Web;

namespace suanpan.API.Components.Exceptions
{
    public class DigitalSignatureException : RESTException
    {
        public DigitalSignatureException(Exception ex):
            base(ex, HttpStatusCode.Unauthorized, string.Format("Digital Signing failed. {0}", ex.Message))
        {
           
        }
        public DigitalSignatureException(string statusDescription):
            base(new Exception(statusDescription), HttpStatusCode.Unauthorized, statusDescription)
        {
        }
       
        public override void SetResponse()
        {
            base.SetResponse();
            WebOperationContext.Current.OutgoingResponse.Headers[HttpResponseHeader.WwwAuthenticate] = "Please digitally sign your request";
        }
    }
}
